import React, { useEffect, useState } from 'react';
import axios from "axios"
const Detail = (props) => {
    const id = props.match.params.id
    const [detail, setDetail] = useState(null)
    useEffect(() => {
        axios.get('/shop').then(res => {
            setDetail(res.data.filter(item => item.id == id)[0])
        })
    }, [])
    return (
        <div>
            {detail ? <div>
                {detail.title}
            </div> : ''}
        </div>
    );
}

export default Detail;
